package cn.sofwin.blog.web;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

@WebListener
public class SessionListener implements HttpSessionListener {

    public static int count = 0;

    @Override
    public void sessionCreated(HttpSessionEvent se) {
        count++;
        System.out.println("在线用户：" + count);
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        count--;
        System.out.println("在线用户：" + count);
    }
}
